﻿using System;
using System.Collections.Generic;
using System.Linq.Expressions;

namespace CommonEngine.STSDB.Core
{
    public interface INoSQLDB
    {
        bool Exists<T>(T model) where T : class, IEn;

        bool Insert<T>(T model) where T : class, IEn;
        bool Insert<T>(List<T> models) where T : class, IEn;

        bool Update<T>(T model) where T : class, IEn;
        bool Update<T>(List<T> models) where T : class, IEn;

        bool Delete<T>(Guid ID) where T : class, IEn;
        bool Delete<T>(T model) where T : class, IEn;
        bool Delete<T>(List<T> models) where T : class, IEn;
        bool Delete<T>(Expression<Func<T, bool>> express) where T : class, IEn;
        bool Clear<T>() where T : class, IEn;

        T GetOne<T>(Guid ID) where T : class, IEn;
        T GetOne<T>(Expression<Func<T, bool>> express) where T : class, IEn;

        List<T> GetMore<T>(Expression<Func<T, bool>> express) where T : class, IEn;
        List<T> GetMore<T>(Expression<Func<T, bool>> express, Expression<Func<T, object>> OrderExpress, bool IsASC = true) where T : class, IEn;

        int Count<T>(Expression<Func<T, bool>> express = null) where T : class, IEn;
        List<T> PageByExp<T>(Expression<Func<T, bool>> express, Expression<Func<T, object>> By, bool IsAsc, int pageIndex, int pageSize, out int totalRecord) where T : class, IEn;
    }
}
